using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace com.exceptionalsoftware.spacetime.KML
{
	[Serializable()]
    [XmlType(TypeName = "NetworkLinkType")]
    public class NetworkLink : Feature
	{
        private LinkElementNameChoiceEnum linkChoiceField;
        private bool visibility, flyToView;
        private Link linkField;

        public NetworkLink()
        {
            this.visibility = false;
            this.flyToView = false;
        }

        [XmlElement(ElementName = "refreshVisibility", DataType = "boolean")]
        [DefaultValue(false)]
        public bool RefreshVisibility
        {
            get { return this.visibility; }
            set { this.visibility = value; }
        }

        [XmlElement(ElementName = "flyToView", DataType = "boolean")]
        [DefaultValue(false)]
        public bool FlyToView
        {
            get { return this.flyToView; }
            set { this.flyToView = value; }
        }

        [XmlElement(ElementName = "Link", Type = typeof(Link))]
        [XmlElement(ElementName = "Url", Type = typeof(Link))]
        [XmlChoiceIdentifier(MemberName = "LinkChoice")]
        public Link Link
        {
            get { return this.linkField; }
            set { this.linkField = value; }
        }

        [XmlIgnore()]
        public LinkElementNameChoiceEnum LinkChoice
        {
            get { return this.linkChoiceField; }
            set { this.linkChoiceField = value; }
        }
    }

    public enum LinkElementNameChoiceEnum { Link, Url }
}